]> permondes.de Git - Analog_Engine.git/blobdiff - scripts/TP2 10.28 Potential of a charged sphere.LACE
Potential of charged sphere
[Analog_Engine.git] / scripts / TP2 10.28 Potential of a charged sphere.LACE
diff --git a/scripts/TP2 10.28 Potential of a charged sphere.LACE b/scripts/TP2 10.28 Potential of a charged sphere.LACE
new file mode 100644 (file)
index 0000000..1284191
--- /dev/null
@@ -0,0 +1,44 @@
+# Determine the potential (inside and outside) of a charged sphere (radius R) with a constant internal charge density rho0.
+#
+# phi(r)'' = -rho0/epsilon0 - 2/r * phi(r)'
+#   with rho0 = 0 outside of sphere
+#   using t as variable for r
+#
+# compound functions used:
+# Open Amplifier
+define openamp (weight*: variable-1, weight*: variable-2) -> output
+  isum (weight*: variable-1, weight*: variable-2) -> output
+    connect (FB:) -> GND 
+    
+# Division
+define idivide (numerator, denominator) -> -quotient
+  openamp (numerator, product) -> -quotient
+  multiply (-quotient, denominator) -> product
+  
+# coefficients
+coefficient.1      -> factor0,2 # shall be set to 0.2
+coefficient.2 (-1) -> -rho0/epsilon0
+coefficient.3 (-1) -> -phi0
+coefficinet.4 (-1) -> -R        # -radius of sphere
+
+# generate a ramp of t
+iintegrate (-1) -> t
+
+# distinguish in sphere or outside
+compare (t, -R) -> -rho/epsilon0_l
+  LT0: -rho/epsilon0   # in sphere, 
+  GT0: GND             # outside sphere
+
+# calculate phi
+iintegrate (1*: -rho0/epsilon0_l, 10*: -0.2/r*phi') -> -phi' # need 2/r*phi' thus 10* input
+iintegrate (-phi') -> phi
+  IC: -phi0
+invert(-phi') -> phi'
+
+# doing this division by t first because phi' is low when also t is, thus there is the chance of less overload
+idivide (phi', t) -> -phi'/t
+cmultiply (-phi'/t, factor0.2) -> -0.2/r*phi'
+
+output(t)     -> out.x
+output(phi')  -> out.y
+output(phi)   -> out.z